package org.evs.odesk.programmingSkills;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * @author Dmitry Kalachov
 *         Kermit, a frog hops in a particular way such that:
 *         1. He hops 20cm in the first hop, 10cm in the second hop and 5cm in the third hop.
 *         2. After three hops Kermit rests for a while and then again follows the same hopping pattern.
 * 
 *         Calculate the total distance travelled by Kermit (in centimeters) for the provided number of hops. Exactly 4
 *         numbers of hops will be provided to the program (one number per line) as per the below example.
 * 
 *         Suppose the following number of hops is provided to the program:
 * 
 *         4
 *         6
 *         3
 *         5
 * 
 *         Then the total distance covered should be displayed as follows:
 * 
 *         55
 *         70
 *         35
 *         65
 */
public class Task_FrogHops {

    public static void main(String[] args) throws IOException {
        BufferedReader consoleReader = new BufferedReader(new InputStreamReader(System.in));
        String firstLine = consoleReader.readLine();
        String secondLine = consoleReader.readLine();
        String thirdLine = consoleReader.readLine();
        String fourLine = consoleReader.readLine();

        int firstInt = Integer.parseInt(firstLine.trim());
        int secondInt = Integer.parseInt(secondLine.trim());
        int thirdInt = Integer.parseInt(thirdLine.trim());
        int fourInt = Integer.parseInt(fourLine.trim());

        System.out.println(calculateDistance(firstInt));
        System.out.println(calculateDistance(secondInt));
        System.out.println(calculateDistance(thirdInt));
        System.out.println(calculateDistance(fourInt));

    }

    public static int calculateDistance(int numberOfHops) {
        int distance = 0;
        for (int i = 1; i <= numberOfHops; i++) {
            int number = i % 3;

            if (number == 1) {
                distance += 20;
            } else if (number == 2) {
                distance += 10;
            } else if (number == 0) {
                distance += 5;
            }
        }

        return distance;
    }

}
